Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(#463) Ensure sensu::plugins are managed before checks #755

Merged
merged 1 commit into from
Jul 19, 2017

Conversation

jeffmccune
Copy link
Collaborator

Without this patch plugins may be managed after the checks which use them. This
patch addresses the problem by adding a well known inert resource named
Anchor[plugins_before_checks]. The sensu::check and sensu_check_config type
are managed after this anchor. The sensu::plugin defined type is managed
before this anchor. The anchor approach has been implemented over collections
to avoid realizing resources which the end user may be using.

Resolves #463

@@ -666,6 +664,10 @@
$_purge_mutators = $full_purge_hash['mutators']
}

# (#463) This well-known anchor serves as a reference point so all checks are
# managed after all plugins. It must always exist in the catalog.
anchor { 'plugins_before_checks': }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We want to kill off the anchor pattern in the next big refactor after the data types. Is there another way we can do this, such as using the spaceship operator?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought about using the spaceship operator but didn't because it's very likely some end users will have virtual or exported check resources. Collections realize resources, which would be a PITA for the end users.

This isn't the full blown anchor pattern, which is more about class containment. This is more of a lightweight, "Here's a single, well-known reference point to establish before and after."

I chatted with some people in the Puppet slack, and the best alternative to the anchor idea was https://github.com/binford2k/binford2k-manifold, but I did get some validating feedback a single anchor is reasonable in this situation and I like how simple it is to explain. All plugins are managed before the anchor, all checks are managed after the anchor, the anchor always exists in the catalog.

Without this patch plugins may be managed after the checks which use them.  This
patch addresses the problem by adding a well known inert resource named
`Anchor[plugins_before_checks]`.  The sensu::check and sensu_check_config type
are managed after this anchor.  The sensu::plugin defined type is managed
before this anchor.  The anchor approach has been implemented over collections
to avoid realizing resources which the end user may be using.

Resolves sensu#463
@jeffmccune jeffmccune force-pushed the 463_plugins_before_checks branch from a1b12b6 to 0788152 Compare July 19, 2017 20:08
@jeffmccune
Copy link
Collaborator Author

Rebased.

@ghoneycutt
Copy link
Collaborator

That was fast!

@jeffmccune
Copy link
Collaborator Author

That was fast!

Thanks! Was a good place to switch context, so good timing on the merge.

@ghoneycutt ghoneycutt merged commit 998ea0c into sensu:master Jul 19, 2017
@ghoneycutt
Copy link
Collaborator

Released in v2.27.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants